<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Simple login session</title>
</head>
<body>
   <H1>LOGIN FORM</H1>
   <%
   String myname =  (String)session.getAttribute("username");
   
   if(myname!=null)
       {
        out.println("Welcome  "+myname+"  , <a href=\"logout.jsp\" >Logout</a>");
       }
   else 
       {
       %>
       <form action="check_login.jsp" method="post">
           <table>
               <tr>
                   <td> Username  : </td><td> <input name="username" size=15 type="text" /> </td> 
               </tr>
               <tr>
                   <td> Password  : </td><td> <input name="password" size=15 type="text" /> </td> 
               </tr>
           </table>
           <input type="submit" value="login" />
       </form>
       <% 
       }
       %>
</body>
</html>